put return & "You clicked the ΓÇ£CancelΓÇ¥ button." into bg fld "theResult"
else
put the result into temp
put "Menu item selected was:" && item 1 of temp & return into bg fld "theResult"
if item 2 of temp is empty then
put "String 1 was: empty" & return after bg fld "theResult"
else put "String 1 was:" && item 2 of temp & return after bg fld "theResult"
if item 3 of temp is empty then
put "String 2 was: empty" after bg fld "theResult"
else put "String 2 was:" && item 3 of temp after bg fld "theResult"
end if
end mouseUp
-- part 3 (button)
-- low flags: 80
-- high flags: A003
-- rect: left=426 top=260 right=282 bottom=461
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: OK
----- HyperTalk script -----
on mouseUp
lock screen
hide me
hide cd pict
unlock screen with zoom in
end mouseUp
-- part 4 (field)
-- low flags: 81
-- high flags: 2004
-- rect: left=162 top=63 right=284 bottom=350
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: theList
----- HyperTalk script -----
on mouseUp
lock screen
hide me
unlock screen with zoom in
end mouseUp
-- part 6 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=11 top=4 right=64 bottom=78
-- title width / last selected line: 0
-- icon id / first selected line: 529 / 529
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: SD
-- part contents for background part 21
----- text -----
ShowDialog XCMD Type 4
-- part contents for background part 30
----- text -----
16
-- part contents for background part 18
----- text -----
ShowDialog XCMD Type 4 displays an "ask" or
"answer" dialog that contains a popup menu and as many Editable Text fields as you desire.
The items in the popup menu are constructed on the fly by passing to ShowDialog a variable containing the items that you would like to appear in the menu, separated by commas. You can modify the style attributes of the individual menu items, enable and disable them, and even attach icons to them, all on the fly.
You also tell ShowDialog which one of the menu items is to be checked when the dialog is initially displayed. When the OK button is clicked, "the result" will contain the item number from the menu that was currently selected, along with the text of your Editable Text fields in a return-delimited list.
HyperCard runs on System 3.2 and above, but popup menus were not implemented in the Toolbox until System 4.0. ShowDialog first checks your system configuration and then exits gracefully
(with a beep) if you are running an early system, thus saving you from a fiery crash.
If you've been using versions of ShowDialog older than 1.6, please note that the result for Type 4 is now RETURN-delimited, instead of comma-delimited. ShowDialog Type 4 can also now have as many Editable Text fields as you desire.
Menu items can be disabled (grayed out) by preceding the item with a left parenthesis, like this: (theItem. To insert a menu break, put (- as an item in your menu list. The Toolbox will automatically extend the hyphen the length of the menu; the "(" will cause it to be disabled, so that the menu break cannot be selected.
To control the character style of the individual menu items, prefix the item with the modifier character "<" and a letter standing for the desired attribute.
<BtheItem for bold
<ItheItem for italic
<OtheItem for outline
<UtheItem for underline
<StheItem for shadow
To include an icon to the left of a menu item, prefix the text of the item with a circumflex (^) followed by an ASCII character. The ordinal value of this character plus 208 yields the resource ID of the ICON to display. • Click here for list. •
Constructing DLOG/DITL templates for Type 4 of ShowDialog XCMD is only slightly more involved than for the others.
Constructing the popup menu:
The popup menu consists of two DITL items, which MUST be items 5 and 6.
They are:
DITL item #5: an ENABLED useritem. This will be your popup "hot spot."
DITL item #6: DISABLED static text. This will be your popup menu title. You cannot modify the popup menu title on the fly. Enter in the text string in the DITL template.
These two items can be as LONG as you want, but both MUST be 17 pixels high. This is so that the popup will be positioned correctly on top of the hot spot and the title will hilite correctly.
The popup menu title (DITL item #6) MUST be positioned TO THE LEFT of the hot spot (item #5). They should touch each other by ONE pixel (this is for cosmetic reasons only). • Click here to see. •
Follow this outline when constructing the DITL resource:
item #1: OK button (the default)
item #2: Cancel button
item #3: Editable Text field, if you want one* (to contain default entry string)
item #4: Editable Text field (if you want one)*
item #5: Popup menu hot spot (ENABLED useritem);
item #6: Popup menu title (DISABLED static text);
remaining items: Static Text fields, icons, and PICT's
* if you don't want any fields of Editable Text, it's okay to have items 3 and 4 be icons, static text, PICTs, etc.
The ONLY items that are to be ENABLED are buttons, your popup hot spot, and Editable Text fields.
Your dialog will be displayed with the popup menu item selected that you specified in the parameter list. When you click on the hot spot the popup menu title will invert and the popup menu will appear over the hot spot.
The result consists of a return-delimited list. The popup menu item number currently selected when the OK button is clicked will be returned as line 1 of "the result." The text in the Editable Text fields will be returned as the remaining lines of "the result."
If the user clicks CANCEL "the result" will be empty.